
#include <fstream>
#include <iostream>
using namespace std;


int main( void ) {
	ifstream ifs( "./getline", ios::in );
	if( !ifs ){
		cerr << "err" << endl;
	}

	char buf[256];
	while(1){
		ifs.getline( buf, 256, '\n' );
		if(!ifs) break;
		else{
			cout << buf << endl;
			cout << "ifs's statue : " << ifs.rdstate( ) << endl;
		}
	}
	/*
	ifs.getline( buf, 256, '\n' ); // aa
	cout << buf << endl;
	cout << "ifs's statue : " << ifs.rdstate( ) << endl;

	ifs.getline( buf, 256, '\n' );
	cout << buf << endl;
	cout << "ifs's statue : " << ifs.rdstate( ) << endl;

	ifs.getline( buf, 256, '\n' );
	cout << buf << endl;
	cout << "ifs's statue : " << ifs.rdstate( ) << endl;

	ifs.getline( buf, 256, '\n' );
	cout << buf << endl;
	cout << "ifs's statue : " << ifs.rdstate( ) << endl;

	ifs.getline( buf, 256, '\n' );
	cout << buf << endl;
	cout << "ifs's statue : " << ifs.rdstate( ) << endl;

	ifs.getline( buf, 256, '\n' );
	cout << buf << endl;
	cout << "ifs's statue : " << ifs.rdstate( ) << endl;
	*/


	ifs.close( );

	return 0;
}

